home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
2336A.ZIP
/
SCRDISK1.EXE
/
arc
/
SKELETON.C
< prev
next >
Wrap
Text File
|
1990-04-23
|
5KB
|
217 lines
/*----------------------------------------------------------------------------
Turbo ScrEdit Skeleton v.1.0
for Turbo Pascal 4.0, 5.0, 5.5
Refer to TURBO SCREDIT TUTOR - PART 2 for a complete discussion on how
this file is to be used.
----------------------------------------------------------------------------*/
#include <conio.h>
/*--**Version**-*/
/*--**Buffers**-*/
/*--**User Variables**-*/
int Demo_Screen_Pointer;
int Demo_Current_Screen;
int Demo_Load_Screen;
int Demo_Mode;
/*--** Example of loading and displaying screens**-*/
void Load_Screen()
{
S_Num = -1;
while (S_Num == -1)
{
Demo_Screen_Pointer++;
switch (Demo_Screen_Pointer)
{
/*--**Screens**-*/
}
if (S_Num == -1) Demo_Screen_Pointer = 0;
}
strcpy(S_UserMsg,
"<F1> change screen <ESC> exit Press special keys for demo ");
}
void Initialize_Program()
{
/*--**ScreenFileName**-*/
/*--**InitRoutines**-*/
/*--**System Switches**-*/
S_ErrorSound = 1;
S_ErrorFreq = 300;
S_ErrorDur = 50;
S_ErrorBg = RED;
S_ErrorFg = YELLOW;
S_HelpSound = 1;
S_HelpFreq = 200;
S_HelpDur = 50;
S_HelpBg = BLUE;
S_HelpFg = CYAN;
S_UserSound = 1;
S_UserFreq = 100;
S_UserDur = 50;
S_UserBg = BLACK;
S_UserFg = WHITE;
S_UserMsg[0] = 0;
S_ShowStatus = 1;
S_StBg = BLACK;
S_StFg = GREEN;
S_StLabelBg = LIGHTGRAY;
S_StLabelFg = BLACK;
S_EnterAsTab = 0;
S_AutoHelp = 0;
S_AutoValidate = 0;
S_Cursor = S_NORMAL;
S_Point = -1;
/*--** 1st Example Code **-*/
Demo_Current_Screen = -1;
Demo_Mode = 1;
Load_Screen();
}
void Process_Current_Screen()
{
/*--** Demo mode 2 **-*/
if (Demo_Mode == 2)
{
if (s_indx->A.s_compiledind[S_Num] < 3)
S_ReadKey();
else
do
{
if (S_Point > s_indx->A.s_count[S_Num]) S_Point = -1;
while ((S_Point==-1)||(s_field->C.s_type[S_Point]>9))
if (++S_Point >= s_indx->A.s_count[S_Num]) S_Point = -1;
if (S_UserMsg[0]!=0)
{
itoa(S_Point,S_NewStr,10);
strcpy(S_UserMsg,"Field <");
strcat(S_UserMsg,S_NewStr);
strcat(S_UserMsg,">");
}
S_ReadField();
if ((S_Enter)||(S_Tab))
S_Point++;
}
while ((!S_Alt)&&(!S_Ctrl) && (!S_Fkey) && (!S_Enter));
}
/*--** Demo mode 0 or 1 **-*/
if (Demo_Mode != 2)
S_ReadScreen();
/*--** Example code for demonstration mode **-*/
if ((S_F1) && (Demo_Mode>0))
{
strcpy(S_UserMsg,"Press any key to load the next screen");
S_ReadKey();
Load_Screen();
}
/*--**Special Key Testing**-*/
if ((S_Fkey) && (!S_F1))
{
strcpy(S_UserMsg,"< >");
if (S_Ch > 31) S_UserMsg[1]=S_Ch;
if (S_ScrollLock) strcat(S_UserMsg,"<Scroll Lock>");
if (S_NumLock) strcat(S_UserMsg,"<Num Lock>");
if (S_Caps) strcat(S_UserMsg,"<Caps>");
if (S_InsertMode) strcat(S_UserMsg,"<Insert Mode>");
if (S_LeftShift) strcat(S_UserMsg,"<Left Shift>");
if (S_RightShift) strcat(S_UserMsg,"<Right Shift>");
if (S_Alt) strcat(S_UserMsg,"< Alt >");
if (S_Ctrl) strcat(S_UserMsg,"< Ctrl >");
if (S_Esc) strcat(S_UserMsg,"<Escape>");
if (S_F1) strcat(S_UserMsg,"<F1>");
if (S_F2) strcat(S_UserMsg,"<F2>");
if (S_F3) strcat(S_UserMsg,"<F3>");
if (S_F4) strcat(S_UserMsg,"<F4>");
if (S_F5) strcat(S_UserMsg,"<F5>");
if (S_F6) strcat(S_UserMsg,"<F6>");
if (S_F7) strcat(S_UserMsg,"<F7>");
if (S_F8) strcat(S_UserMsg,"<F8>");
if (S_F9) strcat(S_UserMsg,"<F9>");
if (S_F10) strcat(S_UserMsg,"<F10>");
if (S_F11) strcat(S_UserMsg,"<F11>");
if (S_F12) strcat(S_UserMsg,"<F12>");
if (S_Home) strcat(S_UserMsg,"<Home>");
if (S_End) strcat(S_UserMsg,"<End>");
if (S_PgUp) strcat(S_UserMsg,"<PgUp>");
if (S_PgDn) strcat(S_UserMsg,"<PgDn>");
if (S_Left) strcat(S_UserMsg,"<Left>");
if (S_Right) strcat(S_UserMsg,"<Right>");
if (S_Up) strcat(S_UserMsg,"<Up>");
if (S_Down) strcat(S_UserMsg,"<Down>");
if (S_Ins) strcat(S_UserMsg,"<Insert>");
if (S_Del) strcat(S_UserMsg,"<Delete>");
if (S_Tab) strcat(S_UserMsg,"<Tab>");
if (S_BkSp) strcat(S_UserMsg,"<Back Space>");
if (S_Enter) strcat(S_UserMsg,"<Enter>");
}
}
main()
{
Initialize_Program();
while (!S_Esc) Process_Current_Screen();
/*--** Closing The screen file **--*/
S_CloseScreenFile();
}